package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.Role;
import com.itheima.pojo.User;
import com.itheima.service.RoleService;
import com.itheima.service.UserService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(path = "/role")
public class RoleController {
    @Reference
    private RoleService roleService;


    /**
     * 分页查询检查项数据
     * @param pageBean
     * @return
     */
    //分页查询
    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean pageBean){
        return roleService.findPage(pageBean);
    }

    //增
   /* @RequestMapping("/add")
    public Result addWithUser(@RequestBody Role role, Integer[] userIds,
                              Integer[] permissionIds,
                              Integer[] menuIds){
        try{
            roleService.add(role,userIds,permissionIds,menuIds);
            return new Result(true, "增加成功");
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false, "增加失败");
        }
    }*/


  /* //删
    @DeleteMapping(path = "/{id}")
    public Result deleteById(@PathVariable Integer id){
        try {
            roleService.deleteById(id);
            return new Result(true, "删除角色成功");
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, "删除角色失败");
        }
    }*/
}
